package snowflake

import (
	"github.com/bwmarrin/snowflake"
)

type Snowflake struct {
	node *snowflake.Node
}

func NewSnowflake(nodeID int64) (*Snowflake, error) {
	node, err := snowflake.NewNode(nodeID)
	if err != nil {
		return nil, err
	}

	return &Snowflake{node: node}, nil
}

func (s *Snowflake) Generate() int64 {
	return s.node.Generate().Int64()
}